/* 
 * File:   ResourceManager.h
 * Author: aljosa
 *
 * Created on June 17, 2010, 3:35 PM
 */

#ifndef _RESOURCEMANAGER_H
#define	_RESOURCEMANAGER_H

#include <map>
#include "Texture.h"

using namespace std;

namespace xEngine
{
    namespace Resources
    {
        class ResourceManager {
        public:
            // Constructor, destructor
            ResourceManager();
            virtual ~ResourceManager();

            // Init, shutdown
            bool init();
            void shutDown();

            // Hash tables
            map<string, Texture> textures;

            // Setters, getters
            Texture* getTexture(string filename);

            // Returns texture addres quick, free of checking, inline
            inline unsigned getTextureId(string filename) {

                // In case there is no texture with this name application could crash
                return (* this->textures.find(filename)).second.texID;
            }


            // Singleton
            static ResourceManager &getInstance();
        private:
            // Singleton
            static ResourceManager instance;

        };
    }
}



#endif	/* _RESOURCEMANAGER_H */

